home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
PROGRAMMING
/
DESKLIBC
/
SOURCES.ZIP
/
DeskLib
/
!DLSources
/
Libraries
/
Str
/
c
/
strnicmp
< prev
next >
Wrap
Text File
|
1995-07-08
|
1KB
|
41 lines
/*
#### # # # #
# # # # # The FreeWare C library for
# # ## ### # # # # ### RISC OS machines
# # # # # # # # # # # ___________________________________
# # #### ### ## # # # #
# # # # # # # # # # Please refer to the accompanying
#### ### #### # # ##### # ### documentation for conditions of use
________________________________________________________________________
File: Str.strnicmp.c
Author: Copyright © 1994 Tim Browse
Version: 1.00 (06 Mar 1994)
Purpose: Case-insensitive version of strncmp
*/
#include <ctype.h>
#include "DeskLib:Str.h"
int strnicmp(char *s1, char *s2, size_t n)
{
char ch1 = 0,
ch2 = 0;
for(;;)
{
if ((n == 0) || ((*s1 == 0) && (*s2 == 0)))
return 0; /* s1 and s2 are equal */
ch1 = toupper(*s1);
ch2 = toupper(*s2);
if (ch1 != ch2)
return (int) (ch1 - ch2);
s1++;
s2++;
n--;
}
}